package com.csdj.wenjun.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.csdj.wenjun.entity.Jifenjilu;
import com.csdj.wenjun.service.JifenjiluService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wenjun
 * @since 2022-01-12
 */
@RestController
@RequestMapping("/jifenjilu")
public class JifenjiluController {
    @Autowired
    private JifenjiluService jifenjiluService;
    @GetMapping("/selectjifenjilu")
    public List selectuserid(@RequestParam int id){
        QueryWrapper<Jifenjilu> queryWrapper=new QueryWrapper<>();
        queryWrapper.lambda().eq(Jifenjilu::getUserid,id).orderByDesc(true,Jifenjilu::getId);
        return jifenjiluService.list(queryWrapper);
    }
    @GetMapping("/test")
    public Page test(@RequestParam int id,@RequestParam int yeshu){
        QueryWrapper<Jifenjilu> queryWrapper=new QueryWrapper<>();
        queryWrapper.lambda().eq(Jifenjilu::getUserid,id).orderByDesc(true,Jifenjilu::getId);
        Page<Jifenjilu> producePage = new Page<>(yeshu,5);
        Page<Jifenjilu> page = jifenjiluService.page(producePage,queryWrapper);
        return page;
    }
}
